package com.jron.cqiu.kernel.mail;

import com.jron.cqiu.util.Instance;
import org.apache.commons.mail.EmailAttachment;
import org.apache.commons.mail.HtmlEmail;

import javax.mail.Message;

/**
 * Created by Intellij IDEA.
 *
 * @Author: Yejw
 * @Date: 2008-6-17
 * @Time: 9:14:50
 */
public interface IMail {

    /**
     *
     */
    IMail INSTANCE = Instance.MAIL_INSTANCE;

    /**
     * @param mailTo
     * @param mailFrom
     * @param mailSubject
     * @param mailBody
     */
    public void sendHtmlMail(String mailTo, String mailFrom, String mailSubject, String mailBody);

    /**
     * @param mailTo
     * @param nameTo
     * @param mailFrom
     * @param nameFrom
     * @param mailSubject
     * @param mailBody
     */
    public void sendHtmlMail(String mailTo, String nameTo, String mailFrom, String nameFrom, String mailSubject,
                             String mailBody);

    /**
     * @param mailTo
     * @param nameTo
     * @param mailFrom
     * @param nameFrom
     * @param mailSubject
     * @param mailBody
     * @param htmlEmail
     */
    public void sendHtmlMail(String mailTo, String nameTo, String mailFrom, String nameFrom, String mailSubject,
                             String mailBody, HtmlEmail htmlEmail);

    /**
     * @param mailTo
     * @param mailFrom
     * @param mailSubject
     * @param mailBody
     * @param attachment
     */
    public void sendAttachmentMail(String mailTo, String mailFrom, String mailSubject, String mailBody,
                                   EmailAttachment attachment);

    /**
     * @param mailTo
     * @param nameTo
     * @param mailFrom
     * @param nameFrom
     * @param mailSubject
     * @param mailBody
     * @param attachment
     */
    public void sendAttachmentMail(String mailTo, String nameTo, String mailFrom, String nameFrom,
                                   String mailSubject, String mailBody, EmailAttachment... attachment);

    /**
     * @param mailTo
     * @param mailFrom
     * @param mailSubject
     * @param mailBody
     */
    public void sendSimpleMail(String mailTo, String mailFrom, String mailSubject, String mailBody);

    /**
     * @param mailTo
     * @param nameTo
     * @param mailFrom
     * @param nameFrom
     * @param mailSubject
     * @param mailBody
     */
    public void sendSimpleMail(String mailTo, String nameTo, String mailFrom, String nameFrom, String mailSubject,
                               String mailBody);

    /**
     * @param mailHost
     * @param user
     * @param password
     * @param protocol
     * @return
     */
    public Message[] receiveMail(String mailReceiveHost, String user, String password, String protocol);

    /**
     * @param mailHost
     * @param user
     * @param password
     * @return
     */
    public Message[] receiveMail(String mailReceiveHost, String user, String password);

    /**
     * @param attachmentSaveto 附件保存路径
     * @param mails
     */
    public void readMail(String attachmentSaveto, Message... mails);

    /**
     * @param mails
     */
    public void readMail(Message... mails);

}
